
public class ImplementacionArreglo <Type> implements Pila <Type>{

	Type[] datos;
	int curr;
	
	public ImplementacionArreglo(int size){
		
		datos =  (Type[]) new Object[size];
		curr = 0;
	}
	
	public Type peek() {
		
		return datos[curr-1];
	}

	@Override
	public Type pop() {
		
		Type tmp = datos[curr-1];
		datos[curr-1]=null;
		curr--;
		return tmp;
	}

	@Override
	public void push(Type obj) {
		
		curr++;
		datos[curr-1]=obj;
	}

	@Override
	public int size() {
		
		return curr;
	}

	@Override
	public boolean isEmpty() {
		
		if (size()>0)
			return false;
		
		assert size()>=0;
		return true;
		
	}

}
